export default {
  namespaced: true,
  state: {
    cancelTokenArr: [],
    errorMsg: "路由跳转取消请求",
  },
  mutations: {
    pushCancel(state, cancel) {
      state.cancelTokenArr.push(cancel);
    },
    // 取消请求
    clearCancel(state) {
      state.cancelTokenArr.forEach((cancel) => {
        cancel(state.errorMsg);
      });
      state.cancelTokenArr = [];
    },
  },
};
